/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.fzhucc.modules.appletBanner.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author yyg
* @date 2022-11-25
**/
@Entity
@Data
@Table(name="pms_applet_banner")
public class AppletBanner implements Serializable {

    /**
     * 跳转关联类型 - 无
     */
    public static final String SKIP_NOT_HAVE_TYPE = "无";

    /**
     * 跳转关联类型 - 通知公告
     */
    public static final String SKIP_NOTICE_TYPE = "通知公告";

    /**
     * 跳转关联类型 - 活动
     */
    public static final String SKIP_ACTIVITY_TYPE = "活动";

    /**
     * 跳转关联类型 - 项目
     */
    public static final String SKIP_PROJECT_TYPE = "项目";

    /**
     * 跳转关联类型 - 链接 - 喜报需要
     */
    public static final String SKIP_URL_TYPE = "链接";

    /**
     * 跳转关联类型 - 富文本 - 喜报需要
     */
    public static final String SKIP_RICH_TEXT_TYPE = "富文本";

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`img`")
    @ApiModelProperty(value = "图片地址")
    private String img;

    @Column(name = "`name`")
    @ApiModelProperty(value = "名称")
    private String name;

    @Column(name = "`sort`")
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @Column(name = "`is_show`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否小程序展示")
    private Integer isShow;

    @Column(name = "`type`")
    @ApiModelProperty(value = "类型")
    private String type;

    @Column(name = "`text`")
    @ApiModelProperty(value = "通知")
    private String text;

    @Column(name = "`skip_type`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "跳转关联类型用来区别跳转到哪个分类   skip_notice_type")
    private String skipType;

    @Column(name = "`skip_id`")
    @ApiModelProperty(value = "跳转关联的id")
    private String skipId;

    @Column(name = "`context`")
    @ApiModelProperty(value = "喜报内容  富文本 or 链接")
    private String context;

    @Column(name = "`url`")
    @ApiModelProperty(value = "地址")
    private String url;

    @ApiModelProperty(value = "地区划分 即什么地区看的到什么地区的数据,省的看到全部")
    @Column(name = "`org_area`",nullable = false)
    @NotNull
    public String orgArea;

    public void copy(AppletBanner source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
